Solving Potato Bug Problem